package client;
 
import java.rmi.RMISecurityManager;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;

import java.math.BigDecimal;

import compute.Compute;

/**
 * 
 * @author Danilo Rodrigues
 */
public class ComputePi {
    public static void main(String args[]) {
    	System.setSecurityManager(new RMISecurityManager(){
        	public void checkConnect(String host, int port) {}
        	public void checkConnect (String host, int port, Object context) {}
        });
        try {
            String name = "Compute";
            Registry registry = LocateRegistry.getRegistry("");
            Compute comp = (Compute) registry.lookup(name);
            Pi task = new Pi(Integer.parseInt("5"));
            BigDecimal pi = comp.executeTask(task);
            System.out.println(pi);
        } catch (Exception e) {
            System.err.println("ComputePi exception:");
            e.printStackTrace();
        }
    }   
}